package com.itheima.controller;

import com.itheima.domain.vo.PageBeanVo;
import com.itheima.manager.UserInfoManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserInfoController {
    @Autowired
    private UserInfoManager userInfoManager;
    /**
     * 根据时间查找用户活动
     */
    @GetMapping("/userInfo/log")
    public PageBeanVo findUserInfoByDate(@RequestParam(defaultValue = "1") Integer pageNum ,
                                         @RequestParam(defaultValue = "10") Integer pageSize,
                                         String date,String nickName){
        PageBeanVo userInfoByDate = userInfoManager.findUserInfoByDate(pageNum, pageSize, date,nickName);
        return userInfoByDate;
    }
    /**
     * 根据用户名称查找用户活动
     */
    @GetMapping("/userInfor/log")
    public PageBeanVo findUserInfoByUser(@RequestParam(defaultValue = "1") Integer pageNum ,
                                         @RequestParam(defaultValue = "10") Integer pageSize,
                                         String userName){
        PageBeanVo userInfoByUser = userInfoManager.findUserInfoByUser(pageNum, pageSize, userName);
        return userInfoByUser;
    }
}
